/**
 * Created by oneminute on 8/4/14.
 */

var lz = require("../lib/utils/modules")();

exports.post = function (_req, _res, _opts, _callback) {
    var name = _opts.name;
    var user = _opts.user;
    if (!user) {
        _callback(lz.Config.errors.getError(lz.Config.errors.REQUEST_TEMPUSER_ERROR));
        return;
    }

    user.modifyName(name, function(_err) {
        if (_err) {
            lz.Logger.error("/modifyname: 请求错误。");
            _callback(_err, user);
            return;
        }
        lz.Logger.debug("/modifyname: 请求成功。");
        _callback(null, user);
    });
};
